package com.health.filter;

import com.alibaba.druid.util.StringUtils;
import com.health.vo.Result;
import org.springframework.stereotype.Component;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * 登录过滤器-token验证
 */
@Component
public class LoginFilter implements Filter {


    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        HttpServletRequest request= (HttpServletRequest) servletRequest;
        //从请求头中,获取token令牌
        String token = request.getHeader("token");

        Result result=null;
        //判断token是否为空
        if (!StringUtils.isEmpty("token")){

        }else {

        }


    }

    @Override
    public void destroy() {

    }
}
